<script setup lang="ts">
defineProps(["theme"]);
</script>

<template>
  <Flex class="audio-bar">
    <view
      :class="['bar', 'bar-' + item, theme]"
      v-for="item in 20"
      :key="item"
    ></view>
  </Flex>
</template>

<style lang="scss" scoped>
@for $i from 1 through 20 {
  @keyframes ani-#{$i} {
    100% {
      transform: scaleY(random() * 1.5 + 1.2);
    }
  }
}
@keyframes ani {
  100% {
    transform: scaleY(1.5);
  }
}
.audio-bar {
  margin-bottom: calc(80px + env(safe-area-inset-bottom));
}
.bar {
  width: 4px;
  height: 20px;
  background-color: #495bff;
  border-radius: 10px;
  margin: 0 2px;
  // animation: ani 0.3s ease infinite alternate;
  &.black {
    background-color: #ffffff;
  }
}
@for $i from 1 through 20 {
  .bar-#{$i} {
    // animation-delay: random() * 5s;
    animation: ani-#{$i} random() + 0.1s ease infinite alternate;
  }
}
</style>
